#ifndef FORM_H_
#define FORM_H_

#ifdef __cplusplus
extern "C"{
#endif

#include "myinclude.h"
#include "driver.h"
#include "led_bsp.h"
#include "key_bsp.h"
#include "maos_malloc.h"
#include "lcd.h"
#include "comm.h"

typedef struct
{
	u32		handle;
	void	*protect;
	
	void (*pfn_loop)(void);
	void (*pfn_f1)(KEY_EVENT event);
	void (*pfn_f2)(KEY_EVENT event);
	void (*pfn_f3)(KEY_EVENT event);
	void (*pfn_receive)(void *data,u16 len);
}HINTREG;
extern HINTREG hint;
typedef struct
{
	DRIVER	*key;
	DRIVER	*led;
	DRIVER	*beep;
	cCOMM	*comm;
	bool	hint;
	u32		handle;
	u32 	tick;
	void	*protect;
	
	void (*pfn_loop)(void);
	void (*pfn_f1)(KEY_EVENT event);
	void (*pfn_f2)(KEY_EVENT event);
	void (*pfn_f3)(KEY_EVENT event);
	void (*pfn_receive)(void *data,u16 len);
}FORMREG;
extern FORMREG form;
typedef 	void(*FORMBACK)(void*,bool);

#define formMalloc(x)	var->malloc(x)
#define formFree(x)		var->free(x)

u8 get_scanMode(void);
void recover_fun(void);
void save_fun(void);	
bool match_fun(u8 index,char *str);
void form_fun(char *f1,char *f2,char *f3);
void form_jump(u16 handle);
void form_receive(void *data,u16 len);
void form_init(void);
void form_1000_init(void);

void hint_1001_init(u16 x,u16 y,FORMBACK back,u8 step);
void hint_1002_init(u16 x,u16 y,FORMBACK back);
void hint_1003_init(u16 x,u16 y,FORMBACK back);	
void hint_1004_init(u16 x,u16 y,FORMBACK back,u8 row,u8 col);	
void hint_1005_init(u16 x,u16 y,FORMBACK back);	
void hint_1006_init(u16 x,u16 y,u8 mode,u8 index,FORMBACK back);	
void hint_1007_init(u16 x,u16 y,FORMBACK back);

#ifdef __cplusplus
}
#endif
#endif /* FORM_H_ */
